
export const useDialog = (props, emit) => {
    const dialogVisible = ref<boolean>(false);
    dialogVisible.value = props.modelValue;
    watch(
        () => props.modelValue,
        () => {
            dialogVisible.value = props.modelValue;
        }
    );
    watch(dialogVisible.value, async () => {
        emit("update:modelValue", dialogVisible.value);
    });
    const handleClose = (done: () => void) => {
        dialogVisible.value = false;
        emit("update:modelValue", dialogVisible.value);
        done();
    };

    return {
        handleClose,
        dialogVisible,
    }
}